<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ViewModels="clr-namespace:ScrumSprintMonitor.Modules.WorkItemMonitor.ViewModels"
                    xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
                    xmlns:Behaviors="clr-namespace:ScrumSprintMonitor.UI.Wpf.Behaviors;assembly=ScrumSprintMonitor.UI.Wpf"
                    xmlns:chartingprimitives="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"
                    xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"
                    xmlns:ChartingExtensions="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=ScrumSprintMonitor.UI.Wpf">

	<ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="pack://application:,,,/ScrumSprintMonitor.UI.Wpf;component\Styles\ChartResourceDictionary.xaml" />
	</ResourceDictionary.MergedDictionaries>

	<Style x:Key="BurndownChartStyle" BasedOn="{StaticResource BaseChartStyle}" TargetType="{x:Type charting:Chart}">
		<Setter Property="Palette">
			<Setter.Value>
				<datavis:ResourceDictionaryCollection>
					<!-- Blue -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="Black" />
							<GradientStop Color="Black" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
					<!-- Light Green -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="#FFB8C0AC" />
							<GradientStop Color="#FF5F7143" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
					<!-- Red -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="#FFFBB7B5" />
							<GradientStop Color="#FF702828" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
					<!-- Indigo -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="#FFA9A3BD" />
							<GradientStop Color="#FF382C6C" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
					<!-- Magenta -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="#FFB1A1B1" />
							<GradientStop Color="#FF50224F" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
					<!-- Dark Green -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="#FF9DC2B3" />
							<GradientStop Color="#FF1D7554" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
					<!-- Gray Shade -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="#FFB5B5B5" />
							<GradientStop Color="#FF4C4C4C" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
					<!-- Blue -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="#FF98C1DC" />
							<GradientStop Color="#FF0271AE" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
					<!-- Brown -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="#FFC1C0AE" />
							<GradientStop Color="#FF706E41" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
					<!-- Cyan -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="#FFADBDC0" />
							<GradientStop Color="#FF446A73" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
					<!-- Special Blue -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="#FF2F8CE2" />
							<GradientStop Color="#FF0C3E69" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
					<!-- Gray Shade 2 -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="#FFDCDCDC" />
							<GradientStop Color="#FF757575" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
					<!-- Gray Shade 3 -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="#FFF4F4F4" />
							<GradientStop Color="#FFB7B7B7" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
					<!-- Gray Shade 4 -->
					<ResourceDictionary>
						<RadialGradientBrush x:Key="Background" GradientOrigin="-0.1,-0.1" Center="0.075,0.015" RadiusX="1.05" RadiusY="0.9">
							<GradientStop Color="#FFF4F4F4" />
							<GradientStop Color="#FFA3A3A3" Offset="1" />
						</RadialGradientBrush>
						<Style x:Key="DataPointStyle" TargetType="Control">
							<Setter Property="Background" Value="{StaticResource Background}" />
						</Style>
					</ResourceDictionary>
				</datavis:ResourceDictionaryCollection>
			</Setter.Value>
		</Setter>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="charting:Chart">
					<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
						<Grid>
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*" />
								<ColumnDefinition Width="Auto" />
							</Grid.ColumnDefinitions>

							<!--<datavis:Legend x:Name="Legend" Header="{TemplateBinding LegendTitle}" Style="{TemplateBinding LegendStyle}" Grid.Column="1" />-->
							<chartingprimitives:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}" />
						</Grid>
					</Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<DataTemplate DataType="{x:Type ViewModels:SprintBurndownChartViewModel}">
		<Grid Behaviors:BusyIndicatorBehavior.DimBackground="False"
		      Behaviors:BusyIndicatorBehavior.AddMargins="True"
		      Behaviors:BusyIndicatorBehavior.BusyState="{Binding IsBuildingBurndownDataPoints}"
		      Visibility="{Binding BurndownChartVisibility}"
		      Margin="6" MinHeight="100">
			<charting:Chart Style="{StaticResource BurndownChartStyle}">
				<charting:Chart.Resources>
					<Style x:Key="AreaSeriesPathStyle" TargetType="{x:Type Path}">
						<Setter Property="StrokeThickness" Value="2" />
						<Setter Property="Opacity" Value="1" />
					</Style>
				</charting:Chart.Resources>

				<charting:Chart.Series>
					<!--Trend line of the sum of all teams-->
					<charting:LineSeries ItemsSource="{Binding BurndownTrendLineDataPoints}"
					                     Panel.ZIndex="-1000"
					                     IndependentValueBinding="{Binding Time}"
					                     DependentValueBinding="{Binding WorkRemaining}">
						<charting:LineSeries.DataPointStyle>
							<Style TargetType="{x:Type charting:LineDataPoint}" BasedOn="{StaticResource {x:Type charting:LineDataPoint}}">
								<Setter Property="Background" Value="Black" />
								<Setter Property="Opacity" Value="0" />
							</Style>
						</charting:LineSeries.DataPointStyle>
						<charting:LineSeries.PolylineStyle>
							<Style TargetType="{x:Type Polyline}">
								<Setter Property="StrokeThickness" Value="1" />
								<Setter Property="StrokeDashArray" Value="8 8" />
							</Style>
						</charting:LineSeries.PolylineStyle>
					</charting:LineSeries>

					<!--Area that represents the sum of work for all teams-->
					<charting:AreaSeries Title="Total Work"
					                     Panel.ZIndex="-2000"
					                     ItemsSource="{Binding BurndownAggregateDataPoints}"
					                     IndependentValueBinding="{Binding Time}"
					                     DependentValueBinding="{Binding TotalWork}"
					                     PathStyle="{StaticResource AreaSeriesPathStyle}" />

					<!--Area that represents the sum of remaining work for all teams-->
					<charting:AreaSeries Title="Total Work Remaining"
					                     Panel.ZIndex="-1900"
					                     ItemsSource="{Binding BurndownAggregateDataPoints}"
					                     IndependentValueBinding="{Binding Time}"
					                     DependentValueBinding="{Binding WorkRemaining}"
					                     PathStyle="{StaticResource AreaSeriesPathStyle}" />

					<!--Areas that represent the remaining work for each of the teams-->
					<charting:LineSeries Title="{Binding TeamNames[0]}"
					                     Panel.ZIndex="-1500"
					                     ItemsSource="{Binding BurndownDataPointsForTeam[0]}"
					                     IndependentValueBinding="{Binding Time}"
					                     DependentValueBinding="{Binding WorkRemaining}" />
					<charting:LineSeries Title="{Binding TeamNames[1]}"
					                     Panel.ZIndex="-1500"
					                     ItemsSource="{Binding BurndownDataPointsForTeam[1]}"
					                     IndependentValueBinding="{Binding Time}"
					                     DependentValueBinding="{Binding WorkRemaining}" />
					<charting:LineSeries Title="{Binding TeamNames[2]}"
					                     Panel.ZIndex="-1500"
					                     ItemsSource="{Binding BurndownDataPointsForTeam[2]}"
					                     IndependentValueBinding="{Binding Time}"
					                     DependentValueBinding="{Binding WorkRemaining}" />
					<charting:LineSeries Title="{Binding TeamNames[3]}"
					                     Panel.ZIndex="-1500"
					                     ItemsSource="{Binding BurndownDataPointsForTeam[3]}"
					                     IndependentValueBinding="{Binding Time}"
					                     DependentValueBinding="{Binding WorkRemaining}" />
					<charting:LineSeries Title="{Binding TeamNames[4]}"
					                     Panel.ZIndex="-1500"
					                     ItemsSource="{Binding BurndownDataPointsForTeam[4]}"
					                     IndependentValueBinding="{Binding Time}"
					                     DependentValueBinding="{Binding WorkRemaining}" />
					<charting:LineSeries Title="{Binding TeamNames[5]}"
					                     Panel.ZIndex="-1500"
					                     ItemsSource="{Binding BurndownDataPointsForTeam[5]}"
					                     IndependentValueBinding="{Binding Time}"
					                     DependentValueBinding="{Binding WorkRemaining}" />
					<charting:LineSeries Title="{Binding TeamNames[6]}"
					                     Panel.ZIndex="-1500"
					                     ItemsSource="{Binding BurndownDataPointsForTeam[6]}"
					                     IndependentValueBinding="{Binding Time}"
					                     DependentValueBinding="{Binding WorkRemaining}" />
					<charting:LineSeries Title="{Binding TeamNames[7]}"
					                     Panel.ZIndex="-1500"
					                     ItemsSource="{Binding BurndownDataPointsForTeam[7]}"
					                     IndependentValueBinding="{Binding Time}"
					                     DependentValueBinding="{Binding WorkRemaining}" />
				</charting:Chart.Series>

				<charting:Chart.Axes>
					<!-- Vertical axis -->
					<charting:LinearAxis
Orientation="Y"
ExtendRangeToOrigin="True"
Minimum="0"
ShowGridLines="True">
						<charting:LinearAxis.GridLineStyle>
							<Style TargetType="Line">
								<Setter Property="Opacity" Value="0.1" />
								<Setter Property="Stroke" Value="Black" />
							</Style>
						</charting:LinearAxis.GridLineStyle>
					</charting:LinearAxis>
					<!-- Shared horizontal axis -->
					<ChartingExtensions:CustomDateTimeAxis
Orientation="X"
Minimum="{Binding BurndownChartStartDate}"
Maximum="{Binding BurndownChartEndDate}"
DisabledDates="{Binding ExcludedDates}"
IntervalType="Days"
Interval="1">
						<ChartingExtensions:CustomDateTimeAxis.AxisLabelStyle>
							<Style TargetType="charting:DateTimeAxisLabel">
								<Setter Property="StringFormat" Value="{}{0:ddd, MMM d}" />
							</Style>
						</ChartingExtensions:CustomDateTimeAxis.AxisLabelStyle>
					</ChartingExtensions:CustomDateTimeAxis>
				</charting:Chart.Axes>
			</charting:Chart>
		</Grid>
	</DataTemplate>
</ResourceDictionary>